
article.guide
  carousel.deck.container-fluid
    slide.row-fluid
      .col-sm-3
        h3 Cypher
        p.lead Neo4j's graph query language
      .col-sm-9
        p
          | Neo4j's Cypher language is purpose built for working with graph data.
        ul.big
          li uses patterns to describe graph data
          li familiar SQL-like clauses
          li declarative, describing what to find, not how to find it
    slide.row-fluid
      .col-sm-3
        h3 CREATE
        p.lead Create a node
      .col-sm-9
        p
          | Let's use Cypher to generate a small social graph.
        figure
          pre.pre-scrollable.code.runnable(mode='cypher').
            CREATE (ee:Person { name: "Emil", from: "Sweden", klout: 99 })
        ul
          li
            code CREATE
            |  clause to create data
          li
            code ()
            |  parenthesis to indicate a node
          li
            code ee:Person
            |  a variable 'ee' and label 'Person' for the new node
          li
            code {}
            |  brackets to add properties to the node
    slide.row-fluid
      .col-sm-3
        h3 MATCH
        p.lead Finding nodes
      .col-sm-9
        p
          | Now find the node representing Emil:
        figure
          pre.pre-scrollable.code.runnable(mode='cypher').
            MATCH (ee:Person) WHERE ee.name = "Emil" RETURN ee;
        ul
          li
            code MATCH
            |  clause to specify a pattern of nodes and relationships
          li
            code (ee:Person)
            |  a single node pattern with label 'Person' which will assign matches to the variable 'ee'
          li
            code WHERE
            |  clause to constrain the results
          li
            code ee.name = "Emil"
            |  compares name property to the value "Emil"
          li
            code RETURN
            |  clause used to request particular results
    slide.row-fluid
      .col-sm-3
        h3 CREATE more
        p.lead Nodes and relationships
      .col-sm-9
        p
          code CREATE
          | clauses can create many nodes and relationships at once.
        figure
          pre.pre-scrollable.code.runnable(mode='cypher').
            MATCH (ee:Person) WHERE ee.name = "Emil"
            CREATE (js:Person { name: "Johan", from: "Sweden", learn: "surfing" }),
            (ir:Person { name: "Ian", from: "England", title: "author" }),
            (rvb:Person { name: "Rik", from: "Belgium", pet: "Orval" }),
            (ally:Person { name: "Allison", from: "California", hobby: "surfing" }),
            (ee)-[:KNOWS {since: 2001}]->(js),(ee)-[:KNOWS {rating: 5}]->(ir),
            (js)-[:KNOWS]->(ir),(js)-[:KNOWS]->(rvb),
            (ir)-[:KNOWS]->(js),(ir)-[:KNOWS]->(ally),
            (rvb)-[:KNOWS]->(ally)
    slide.row-fluid
      .col-sm-3
        h3 Pattern matching
        p.lead Describe what to find in the graph
      .col-sm-9
        p.summary
          | For instance, a pattern can be used to find Emil's friends:
        figure
          pre.pre-scrollable.code.runnable(mode='cypher').
            MATCH (ee:Person)-[:KNOWS]-(friends)
            WHERE ee.name = "Emil" RETURN ee, friends
        ul
          li
            code MATCH
            | clause to describe the pattern from known Nodes to found Nodes
          li
            code (ee)
            | starts the pattern with a Person (qualified by WHERE)
          li
            code -[:KNOWS]-
            | matches "KNOWS" relationships (in either direction)
          li
            code (friends)
            | will be bound to Emil's friends
    slide.row-fluid
      .col-sm-3
        h3 Recommend
        p.lead Using patterns
      .col-sm-9
        p.summary
          | Pattern matching can be used to make recommendations. Johan is learning to surf, so he may want to find
          | a new friend who already does:
        figure
          pre.pre-scrollable.code.runnable(mode='cypher').
            MATCH (js:Person)-[:KNOWS]-()-[:KNOWS]-(surfer)
            WHERE js.name = "Johan" AND surfer.hobby = "surfing"
            RETURN DISTINCT surfer
        ul
          li
            code ()
            | empty parenthesis to ignore these nodes
          li
            code DISTINCT
            | because more than one path will match the pattern
          li
            code surfer
            | will contain Allison, a friend of a friend who surfs
    slide.row-fluid
      .col-sm-3
        h3 Analyze
        p.lead Using the visual query plan
      .col-sm-9
        p.summary
          | Understand how your query works by prepending&nbsp;
          code EXPLAIN
          | &nbsp; or &nbsp;
          code PROFILE
          | :
        figure
          pre.pre-scrollable.code.runnable(mode='cypher').
            PROFILE MATCH (js:Person)-[:KNOWS]-()-[:KNOWS]-(surfer)
            WHERE js.name = "Johan" AND surfer.hobby = "surfing"
            RETURN DISTINCT surfer
    slide.row-fluid
      .col-sm-3
        h3 Live Cypher warnings
        p.lead Identify query problems in real time
      .col-sm-5
        p As you type, the query editor notifies you about deprecated features
          | and potentially expensive queries.
      .col-sm-4
        img.img-responsive(src='images/screen_cypher_warn.png')
    slide.row-fluid
      .col-sm-4
        h3 Next steps
        p Start your application using Cypher to create and query graph data. Use the REST API
          | to monitor the database. In special cases, consider a plugin.
      .col-sm-4
        h3 Keep getting started
        ul.undecorated
          li
            a(play-topic='intro') Intro
            |  - a guided tour
          li
            a(play-topic='concepts') Concepts
            |  - GraphDB 101
          li
            a(play-topic='movie-graph') The Movie Graph
            |  - create the movie graph
          li
            a(play-topic='northwind-graph') Northwind Graph
            |  - from RDBMS to graph
      .col-sm-4
        h3 Reference
        ul.undecorated
          li
            a(href='http://neo4j.com/developer/guide-importing-data-and-etl/') Full Northwind import example
          li
            a(href="{{ neo4j.version | neo4jCypherRefcardDoc }}/") Cypher
          li
            a(href='{{ neo4j.version | neo4jDeveloperDoc }}/') Neo4j Developer Manual
